home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Printing.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  14.0 KB  |  447 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Printing.h
  3.  
  4.      Contains:    Print Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __PRINTING__
  19. #define __PRINTING__
  20.  
  21. #ifndef __ERRORS__
  22. #include <Errors.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __DIALOGS__
  28. #include <Dialogs.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53.  
  54. enum {
  55.     iPFMaxPgs                    = 128,
  56.     iPrPgFract                    = 120,                            /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  57.     iPrPgFst                    = 1,                            /*Page range constants*/
  58.     iPrPgMax                    = 9999,
  59.     iPrRelease                    = 3,                            /*Current version number of the code.*/
  60.     iPrSavPFil                    = -1,
  61.     iPrAbort                    = 0x0080,
  62.     iPrDevCtl                    = 7,                            /*The PrDevCtl Proc's ctl number*/
  63.     lPrReset                    = 0x00010000,                    /*The PrDevCtl Proc's CParam for reset*/
  64.     lPrLineFeed                    = 0x00030000,
  65.     lPrLFStd                    = 0x0003FFFF,                    /*The PrDevCtl Proc's CParam for std paper advance*/
  66.     lPrLFSixth                    = 0x0003FFFF,
  67.     lPrPageEnd                    = 0x00020000,                    /*The PrDevCtl Proc's CParam for end page*/
  68.     lPrDocOpen                    = 0x00010000,
  69.     lPrPageOpen                    = 0x00040000,
  70.     lPrPageClose                = 0x00020000,
  71.     lPrDocClose                    = 0x00050000,
  72.     iFMgrCtl                    = 8,                            /*The FMgr's Tail-hook Proc's ctl number*/
  73.     iMscCtl                        = 9,                            /*The FMgr's Tail-hook Proc's ctl number*/
  74.     iPvtCtl                        = 10                            /*The FMgr's Tail-hook Proc's ctl number*/
  75. };
  76.  
  77. #define sPrDrvr ".Print"
  78. /*    Error Codes moved to Errors.(hap) */
  79.  
  80. enum {
  81.     pPrGlobals                    = 0x00000944,                    /*The PrVars lo mem area:*/
  82.     bDraftLoop                    = 0,
  83.     bSpoolLoop                    = 1,
  84.     bUser1Loop                    = 2,
  85.     bUser2Loop                    = 3,
  86.     fNewRunBit                    = 2,
  87.     fHiResOK                    = 3,
  88.     fWeOpenedRF                    = 4,                            /*Driver constants */
  89.     iPrBitsCtl                    = 4,
  90.     lScreenBits                    = 0,
  91.     lPaintBits                    = 1,
  92.     lHiScreenBits                = 0x00000002,                    /*The Bitmap Print Proc's Screen Bitmap param*/
  93.     lHiPaintBits                = 0x00000003,                    /*The Bitmap Print Proc's Paint [sq pix] param*/
  94.     iPrIOCtl                    = 5,
  95.     iPrEvtCtl                    = 6,                            /*The PrEvent Proc's ctl number*/
  96.     lPrEvtAll                    = 0x0002FFFD,                    /*The PrEvent Proc's CParam for the entire screen*/
  97.     lPrEvtTop                    = 0x0001FFFD,                    /*The PrEvent Proc's CParam for the top folder*/
  98.     iPrDrvrRef                    = -3
  99. };
  100.  
  101.  
  102. enum {
  103.     getRslDataOp                = 4,
  104.     setRslOp                    = 5,
  105.     draftBitsOp                    = 6,
  106.     noDraftBitsOp                = 7,
  107.     getRotnOp                    = 8,
  108.     NoSuchRsl                    = 1,
  109.     OpNotImpl                    = 2,                            /*the driver doesn't support this opcode*/
  110.     RgType1                        = 1
  111. };
  112.  
  113.  
  114. enum {
  115.     feedCut                        = 0,
  116.     feedFanfold                    = 1,
  117.     feedMechCut                    = 2,
  118.     feedOther                    = 3
  119. };
  120.  
  121. typedef SInt8                             TFeed;
  122.  
  123. enum {
  124.     scanTB                        = 0,
  125.     scanBT                        = 1,
  126.     scanLR                        = 2,
  127.     scanRL                        = 3
  128. };
  129.  
  130. typedef SInt8                             TScan;
  131. /* A Rect Ptr */
  132. typedef Rect *                            TPRect;
  133. typedef CALLBACK_API( void , PrIdleProcPtr )(void );
  134. typedef CALLBACK_API( void , PItemProcPtr )(DialogPtr theDialog, short item);
  135. typedef STACK_UPP_TYPE(PrIdleProcPtr)                             PrIdleUPP;
  136. typedef STACK_UPP_TYPE(PItemProcPtr)                             PItemUPP;
  137. enum { uppPrIdleProcInfo = 0x00000000 };                         /* pascal no_return_value Func() */
  138. enum { uppPItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  139. #define NewPrIdleProc(userRoutine)                                 (PrIdleUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPrIdleProcInfo, GetCurrentArchitecture())
  140. #define NewPItemProc(userRoutine)                                 (PItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPItemProcInfo, GetCurrentArchitecture())
  141. #define CallPrIdleProc(userRoutine)                             CALL_ZERO_PARAMETER_UPP((userRoutine), uppPrIdleProcInfo)
  142. #define CallPItemProc(userRoutine, theDialog, item)             CALL_TWO_PARAMETER_UPP((userRoutine), uppPItemProcInfo, (theDialog), (item))
  143. struct TPrPort {
  144.     GrafPort                         gPort;                        /*The Printer's graf port.*/
  145.     QDProcs                         gProcs;                        /*..and its procs*/
  146.     long                             lGParam1;                    /*16 bytes for private parameter storage.*/
  147.     long                             lGParam2;
  148.     long                             lGParam3;
  149.     long                             lGParam4;
  150.     Boolean                         fOurPtr;                    /*Whether the PrPort allocation was done by us.*/
  151.     Boolean                         fOurBits;                    /*Whether the BitMap allocation was done by us.*/
  152. };
  153. typedef struct TPrPort TPrPort;
  154.  
  155. typedef TPrPort *                        TPPrPort;
  156. typedef TPrPort *                        TPPrPortRef;
  157. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  158.   This is the "PrPeek" record. */
  159. struct TPrInfo {
  160.     short                             iDev;                        /*Font mgr/QuickDraw device code*/
  161.     short                             iVRes;                        /*Resolution of device, in device coordinates*/
  162.     short                             iHRes;                        /*..note: V before H => compatable with Point.*/
  163.     Rect                             rPage;                        /*The page (printable) rectangle in device coordinates.*/
  164. };
  165. typedef struct TPrInfo TPrInfo;
  166.  
  167. typedef TPrInfo *                        TPPrInfo;
  168. /* Print Info Record: The parameters needed for page composition. */
  169. struct TPrStl {
  170.     short                             wDev;
  171.     short                             iPageV;
  172.     short                             iPageH;
  173.     SInt8                             bPort;
  174.     TFeed                             feed;
  175. };
  176. typedef struct TPrStl TPrStl;
  177.  
  178. typedef TPrStl *                        TPPrStl;
  179. struct TPrXInfo {
  180.     short                             iRowBytes;
  181.     short                             iBandV;
  182.     short                             iBandH;
  183.     short                             iDevBytes;
  184.     short                             iBands;
  185.     SInt8                             bPatScale;
  186.     SInt8                             bUlThick;
  187.     SInt8                             bUlOffset;
  188.     SInt8                             bUlShadow;
  189.     TScan                             scan;
  190.     SInt8                             bXInfoX;
  191. };
  192. typedef struct TPrXInfo TPrXInfo;
  193.  
  194. typedef TPrXInfo *                        TPPrXInfo;
  195. struct TPrJob {
  196.     short                             iFstPage;                    /*Page Range.*/
  197.     short                             iLstPage;
  198.     short                             iCopies;                    /*No. copies.*/
  199.     SInt8                             bJDocLoop;                    /*The Doc style: Draft, Spool, .., and ..*/
  200.     Boolean                         fFromUsr;                    /*Printing from an User's App (not PrApp) flag*/
  201.     PrIdleUPP                         pIdleProc;                    /*The Proc called while waiting on IO etc.*/
  202.     StringPtr                         pFileName;                    /*Spool File Name: NIL for default.*/
  203.     short                             iFileVol;                    /*Spool File vol, set to 0 initially*/
  204.     SInt8                             bFileVers;                    /*Spool File version, set to 0 initially*/
  205.     SInt8                             bJobX;                        /*An eXtra byte.*/
  206. };
  207. typedef struct TPrJob TPrJob;
  208.  
  209. typedef TPrJob *                        TPPrJob;
  210. /* Print Job: Print "form" for a single print request. */
  211. struct TPrint {
  212.     short                             iPrVersion;                    /*(2) Printing software version*/
  213.     TPrInfo                         prInfo;                        /*(14) the PrInfo data associated with the current style.*/
  214.     Rect                             rPaper;                        /*(8) The paper rectangle [offset from rPage]*/
  215.     TPrStl                             prStl;                        /*(8)  This print request's style.*/
  216.     TPrInfo                         prInfoPT;                    /*(14)  Print Time Imaging metrics*/
  217.     TPrXInfo                         prXInfo;                    /*(16)  Print-time (expanded) Print info record.*/
  218.     TPrJob                             prJob;                        /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  219.     short                             printX[19];                    /*Spare to fill to 120 bytes!*/
  220. };
  221. typedef struct TPrint TPrint;
  222.  
  223. typedef TPrint *                        TPPrint;
  224. typedef TPPrint *                        THPrint;
  225. struct TPrStatus {
  226.     short                             iTotPages;                    /*Total pages in Print File.*/
  227.     short                             iCurPage;                    /*Current page number*/
  228.     short                             iTotCopies;                    /*Total copies requested*/
  229.     short                             iCurCopy;                    /*Current copy number*/
  230.     short                             iTotBands;                    /*Total bands per page.*/
  231.     short                             iCurBand;                    /*Current band number*/
  232.     Boolean                         fPgDirty;                    /*True if current page has been written to.*/
  233.     Boolean                         fImaging;                    /*Set while in band's DrawPic call.*/
  234.     THPrint                         hPrint;                        /*Handle to the active Printer record*/
  235.     TPPrPortRef                     pPrPort;                    /*Ptr to the active PrPort*/
  236.     PicHandle                         hPic;                        /*Handle to the active Picture*/
  237. };
  238. typedef struct TPrStatus TPrStatus;
  239.  
  240. typedef TPrStatus *                        TPPrStatus;
  241. typedef TPrStatus *                        TPPrStatusRef;
  242.  
  243. /* Print Status: Print information during printing. */
  244. struct TPfPgDir {
  245.     short                             iPages;
  246.     long                             iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  247. };
  248. typedef struct TPfPgDir TPfPgDir;
  249.  
  250. typedef TPfPgDir *                        TPPfPgDir;
  251. typedef TPPfPgDir *                        THPfPgDir;
  252. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  253. /* This is the Printing Dialog Record. Only used by folks appending their own
  254.    DITLs to the print dialogs.    Print Dialog: The Dialog Stream object. */
  255. struct TPrDlg {
  256.     DialogRecord                     Dlg;                        /*The Dialog window*/
  257.     ModalFilterUPP                     pFltrProc;                    /*The Filter Proc.*/
  258.     PItemUPP                         pItemProc;                    /*The Item evaluating proc.*/
  259.     THPrint                         hPrintUsr;                    /*The user's print record.*/
  260.     Boolean                         fDoIt;
  261.     Boolean                         fDone;
  262.     long                             lUser1;                        /*Four longs for apps to hang global data.*/
  263.     long                             lUser2;                        /*Plus more stuff needed by the particular*/
  264.     long                             lUser3;                        /*printing dialog.*/
  265.     long                             lUser4;
  266. };
  267. typedef struct TPrDlg TPrDlg;
  268.  
  269. typedef TPrDlg *                        TPPrDlg;
  270. typedef TPrDlg *                        TPPrDlgRef;
  271. typedef CALLBACK_API( TPPrDlgRef , PDlgInitProcPtr )(THPrint hPrint);
  272. typedef STACK_UPP_TYPE(PDlgInitProcPtr)                         PDlgInitUPP;
  273. enum { uppPDlgInitProcInfo = 0x000000F0 };                         /* pascal 4_bytes Func(4_bytes) */
  274. #define NewPDlgInitProc(userRoutine)                             (PDlgInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPDlgInitProcInfo, GetCurrentArchitecture())
  275. #define CallPDlgInitProc(userRoutine, hPrint)                     CALL_ONE_PARAMETER_UPP((userRoutine), uppPDlgInitProcInfo, (hPrint))
  276. struct TGnlData {
  277.     short                             iOpCode;
  278.     short                             iError;
  279.     long                             lReserved;                    /*more fields here depending on call*/
  280. };
  281. typedef struct TGnlData TGnlData;
  282.  
  283. struct TRslRg {
  284.     short                             iMin;
  285.     short                             iMax;
  286. };
  287. typedef struct TRslRg TRslRg;
  288.  
  289. struct TRslRec {
  290.     short                             iXRsl;
  291.     short                             iYRsl;
  292. };
  293. typedef struct TRslRec TRslRec;
  294.  
  295. struct TGetRslBlk {
  296.     short                             iOpCode;
  297.     short                             iError;
  298.     long                             lReserved;
  299.     short                             iRgType;
  300.     TRslRg                             xRslRg;
  301.     TRslRg                             yRslRg;
  302.     short                             iRslRecCnt;
  303.     TRslRec                         rgRslRec[27];
  304. };
  305. typedef struct TGetRslBlk TGetRslBlk;
  306.  
  307. struct TSetRslBlk {
  308.     short                             iOpCode;
  309.     short                             iError;
  310.     long                             lReserved;
  311.     THPrint                         hPrint;
  312.     short                             iXRsl;
  313.     short                             iYRsl;
  314. };
  315. typedef struct TSetRslBlk TSetRslBlk;
  316.  
  317. struct TDftBitsBlk {
  318.     short                             iOpCode;
  319.     short                             iError;
  320.     long                             lReserved;
  321.     THPrint                         hPrint;
  322. };
  323. typedef struct TDftBitsBlk TDftBitsBlk;
  324.  
  325. struct TGetRotnBlk {
  326.     short                             iOpCode;
  327.     short                             iError;
  328.     long                             lReserved;
  329.     THPrint                         hPrint;
  330.     Boolean                         fLandscape;
  331.     SInt8                             bXtra;
  332. };
  333. typedef struct TGetRotnBlk TGetRotnBlk;
  334.  
  335. EXTERN_API( void )
  336. PrPurge                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xA800, 0x0000, 0xA8FD);
  337.  
  338. EXTERN_API( void )
  339. PrNoPurge                        (void)                                                        FOURWORDINLINE(0x2F3C, 0xB000, 0x0000, 0xA8FD);
  340.  
  341. EXTERN_API( void )
  342. PrOpen                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xC800, 0x0000, 0xA8FD);
  343.  
  344. EXTERN_API( void )
  345. PrClose                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xD000, 0x0000, 0xA8FD);
  346.  
  347. EXTERN_API( void )
  348. PrintDefault                    (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x2004, 0x0480, 0xA8FD);
  349.  
  350. EXTERN_API( Boolean )
  351. PrValidate                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x5204, 0x0498, 0xA8FD);
  352.  
  353. EXTERN_API( Boolean )
  354. PrStlDialog                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x2A04, 0x0484, 0xA8FD);
  355.  
  356. EXTERN_API( Boolean )
  357. PrJobDialog                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x3204, 0x0488, 0xA8FD);
  358.  
  359. EXTERN_API( TPPrDlgRef )
  360. PrStlInit                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x3C04, 0x040C, 0xA8FD);
  361.  
  362. EXTERN_API( TPPrDlgRef )
  363. PrJobInit                        (THPrint                 hPrint)                                FOURWORDINLINE(0x2F3C, 0x4404, 0x0410, 0xA8FD);
  364.  
  365. EXTERN_API( void )
  366. PrJobMerge                        (THPrint                 hPrintSrc,
  367.                                  THPrint                 hPrintDst)                            FOURWORDINLINE(0x2F3C, 0x5804, 0x089C, 0xA8FD);
  368.  
  369. EXTERN_API( Boolean )
  370. PrDlgMain                        (THPrint                 hPrint,
  371.                                  PDlgInitUPP             pDlgInit)                            FOURWORDINLINE(0x2F3C, 0x4A04, 0x0894, 0xA8FD);
  372.  
  373. EXTERN_API( TPPrPortRef )
  374. PrOpenDoc                        (THPrint                 hPrint,
  375.                                  TPPrPortRef             pPrPort,
  376.                                  Ptr                     pIOBuf)                                FOURWORDINLINE(0x2F3C, 0x0400, 0x0C00, 0xA8FD);
  377.  
  378. EXTERN_API( void )
  379. PrCloseDoc                        (TPPrPortRef             pPrPort)                            FOURWORDINLINE(0x2F3C, 0x0800, 0x0484, 0xA8FD);
  380.  
  381. EXTERN_API( void )
  382. PrOpenPage                        (TPPrPortRef             pPrPort,
  383.                                  TPRect                 pPageFrame)                            FOURWORDINLINE(0x2F3C, 0x1000, 0x0808, 0xA8FD);
  384.  
  385. EXTERN_API( void )
  386. PrClosePage                        (TPPrPortRef             pPrPort)                            FOURWORDINLINE(0x2F3C, 0x1800, 0x040C, 0xA8FD);
  387.  
  388. EXTERN_API( void )
  389. PrPicFile                        (THPrint                 hPrint,
  390.                                  TPPrPortRef             pPrPort,
  391.                                  Ptr                     pIOBuf,
  392.                                  Ptr                     pDevBuf,
  393.                                  TPPrStatusRef             prStatus)                            FOURWORDINLINE(0x2F3C, 0x6005, 0x1480, 0xA8FD);
  394.  
  395. EXTERN_API( short )
  396. PrError                            (void)                                                        FOURWORDINLINE(0x2F3C, 0xBA00, 0x0000, 0xA8FD);
  397.  
  398. EXTERN_API( void )
  399. PrSetError                        (short                     iErr)                                FOURWORDINLINE(0x2F3C, 0xC000, 0x0200, 0xA8FD);
  400.  
  401. EXTERN_API( void )
  402. PrGeneral                        (Ptr                     pData)                                FOURWORDINLINE(0x2F3C, 0x7007, 0x0480, 0xA8FD);
  403.  
  404. EXTERN_API( void )
  405. PrDrvrOpen                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x8000, 0x0000, 0xA8FD);
  406.  
  407. EXTERN_API( void )
  408. PrDrvrClose                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x8800, 0x0000, 0xA8FD);
  409.  
  410. EXTERN_API( void )
  411. PrCtlCall                        (short                     iWhichCtl,
  412.                                  long                     lParam1,
  413.                                  long                     lParam2,
  414.                                  long                     lParam3)                            FOURWORDINLINE(0x2F3C, 0xA000, 0x0E00, 0xA8FD);
  415.  
  416. EXTERN_API( Handle )
  417. PrDrvrDCE                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x9400, 0x0000, 0xA8FD);
  418.  
  419. EXTERN_API( short )
  420. PrDrvrVers                        (void)                                                        FOURWORDINLINE(0x2F3C, 0x9A00, 0x0000, 0xA8FD);
  421.  
  422. EXTERN_API( short )
  423. PrLoadDriver                    (void)                                                        FOURWORDINLINE(0x2F3C, 0xD800, 0x0000, 0xA8FD);
  424.  
  425.  
  426.  
  427. #if PRAGMA_STRUCT_ALIGN
  428.     #pragma options align=reset
  429. #elif PRAGMA_STRUCT_PACKPUSH
  430.     #pragma pack(pop)
  431. #elif PRAGMA_STRUCT_PACK
  432.     #pragma pack()
  433. #endif
  434.  
  435. #ifdef PRAGMA_IMPORT_OFF
  436. #pragma import off
  437. #elif PRAGMA_IMPORT
  438. #pragma import reset
  439. #endif
  440.  
  441. #ifdef __cplusplus
  442. }
  443. #endif
  444.  
  445. #endif /* __PRINTING__ */
  446.  
  447.